let path = require('path');
let html = require('html-webpack-plugin')
let webpack = require('webpack');
let { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = function (params) {
  console.log(params.qqq)
  console.log(params.www)
  return {
    mode: "production",
    watch: true,
    watchOptions: {
      aggregateTimeout: 200, // 监听到文件改变之后等200毫秒再去编译
      poll: 1000,// 每一个一秒问一次
      ignored: /node_modules/
    },
    entry: {
      aaa: './src/index.js',
      bbb: './src/main.js'
    },
    output: {
      path: path.resolve(__dirname, '../app2'),
      filename: '[name].[contenthash:8].js'
    },
    plugins: [
      new CleanWebpackPlugin(),
      new webpack.BannerPlugin({ banner: 'hello world', }),
      new html({
        template: './public2/a.html',
        filename: 'a.html',
        chunks: ['aaa']
      }),
      new html({
        template: './public2/b.html',
        filename: 'b.html',
        chunks: ['bbb']
      })
    ]
  }
}